home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- function doexplode()
- {
- myColor.setTransform(myColorNormal);
- this.gotoAndStop("death");
- }
- function dorespawn()
- {
- currentdamage = 0;
- hitted = false;
- flashing = false;
- timerdamage = 0;
- death = false;
- this.gotoAndStop("standing");
- v = false;
- }
- _X = _X - heroe.scrollspeed;
- _Y = _Y - heroe.vscrollspeed;
- hitable = this.hitTest(_parent.mascara);
- if(hitable)
- {
- _visible = true;
- if(this.sprite.hotzone.hitTest(heroe.sprite.hotzone))
- {
- heroe.damage = 2;
- heroe.hitted = true;
- }
- if(this.sprite.hotzone.hitTest(_parent.shoot1) && hitable)
- {
- hitted = true;
- _root.shoot1.impact = true;
- _root.hitted.start();
- }
- if(timerdamage == 0 && hitted)
- {
- timerdamage = FLASHTIME;
- currentdamage += DAMAGE;
- }
- if(timerdamage > 0)
- {
- flashing = true;
- timerdamage % 3 != 0 ? myColor.setTransform(myColorNormal) : myColor.setTransform(myColorTransform);
- timerdamage--;
- }
- if(flashing && timerdamage == 0)
- {
- flashing = false;
- myColor.setTransform(myColorNormal);
- hitted = false;
- }
- if(currentdamage >= MAXDAMAGE)
- {
- myColor.setTransform(myColorTransform);
- death = true;
- }
- if(death && !v)
- {
- _root.shoot1.impact = false;
- _root.windx = 0;
- v = true;
- }
- if(!death)
- {
- if(attack)
- {
- this.gotoAndStop("attack");
- attack = false;
- attacking = true;
- c = 0;
- sentido *= -1;
- }
- if(attacking)
- {
- this.gotoAndStop("attack");
- _root.windx = heroe.hforce * 0.6 * sentido;
- c += 1;
- if(c >= attackTIME)
- {
- attacking = false;
- change = true;
- c = 0;
- _root.windx = 0;
- }
- }
- if(change)
- {
- this.gotoAndStop("change");
- c += 1;
- if(c >= 16)
- {
- change = false;
- attack = true;
- }
- }
- }
- else
- {
- doexplode();
- }
- }
- else
- {
- _visible = false;
- if(death && Math.abs(heroe._x - _X) >= 200)
- {
- dorespawn();
- }
- }
- }
-